<template>
  <f7-page>
    <f7-navbar title="吉林动画学院公务用车申请表" back-link=""></f7-navbar>

    <f7-list inline-labels no-hairlines-md>
      <f7-list-item title="名称" v-bind:after="formContent.title">  </f7-list-item>
      <f7-list-item>
        <f7-label>用车事由</f7-label>
        <f7-input type="textarea" v-bind:value="formContent.reason"></f7-input>
      </f7-list-item>

      <f7-list-item title="乘车人数" v-bind:after="formContent.usageCount">  </f7-list-item>
      <f7-list-item title="开始用车时间" v-bind:after="formContent.beginDate">  </f7-list-item>
      <f7-list-item title="结束用车时间" v-bind:after="formContent.endDate">  </f7-list-item>
      <f7-list-item title="用车起始地点" v-bind:after="formContent.address">  </f7-list-item>
      <f7-list-item title="用车情况" v-bind:after="formContent.city ? '市内' : '市外'"></f7-list-item>
      <f7-list-item title="申请人" v-bind:after="formContent.createBy"></f7-list-item>
      <f7-list-item title="联系电话" v-bind:after="formContent.operatorPhone"></f7-list-item>
      <f7-list-item title="部门陪同人员" v-bind:after="formContent.entourage"></f7-list-item>
      <f7-list-item title="陪同人员电话" v-bind:after="formContent.entouragePhone"></f7-list-item>
      <f7-list-item title="部门负责人" v-bind:after="formContent.depUser"></f7-list-item>
      <f7-list-item title="部门主管领导" v-bind:after="formContent.depManageUser"></f7-list-item>
      <f7-list-item title="校务部" v-bind:after="formContent.schoolUser"></f7-list-item>
      <f7-list-item title="校务部主管领导" v-bind:after="formContent.schoolManageUser"></f7-list-item>

    </f7-list>
    <f7-list>
      <f7-list-item title="车牌号" v-bind:after="formContent.carNo"></f7-list-item>
      <f7-list-item title="起车公里数" v-bind:after="formContent.startKM"></f7-list-item>
      <f7-list-item title="收车公里数" v-bind:after="formContent.endKM"></f7-list-item>
      <f7-list-item >
        <f7-label>注：合计里程金额（大车：5元/公里，小车：2元/公里）</f7-label>
      </f7-list-item>
    </f7-list>

  </f7-page>
</template>

<script>
    export default {
      name: "carApplyView",
      data() {
        return {
          userId: sessionStorage.getItem('userId'),
          pastMemory: {},
          formContent: {
            title: "吉林动画学院公务用车申请表",
            createBy: sessionStorage.getItem('userName'),
            orgName: "动画工程中心",
            orgId: 20769,
            reason:"",
            usageCount: 0,
            beginDate:"",
            endDate:"",
            address: "",
            city: "0",
            operatorPhone:"",
            entourage:"",
            entouragePhone:"",

            depUser:"",
            depManageUser:"",
            schoolUser:"",
            schoolManageUser:"",
            carNo:"",
            startKM:0,
            endKM:0,
          }
        }
      },
      created() {
        this.$f7ready((f7) => {
          let that = this;
          f7.request.setup({
            headers: {
              'AccessToken': sessionStorage.getItem('accessToken'),
              'JSESSIONID': sessionStorage.getItem('userToken'),
            }
          });
          if (that.$f7route.params.id > -1 )  {
            f7.request.json(that.GLOBAL.RequestAddress + '/camel/rest/carapplys', {
              'page': 1,
              'limit': 10,
              'jsonStr': '',
              'otherStr': '',
              'start': '0'
            }, function (result) {
              if (result.totalCount > 0) {
                for (let pm of result.data) {
                  if (pm.id == that.$f7route.params.id) {
                    that.pastMemory = pm;
                    break;
                  }
                }
                if (Object.keys(that.pastMemory).length === 0) {
                  return;
                } else {
                  that.formContent.title = that.pastMemory.title;
                  that.formContent.createBy = that.pastMemory.createBy;
                  that.formContent.createById = that.pastMemory.createById;

                  that.formContent.orgName = that.pastMemory.orgName;
                  that.formContent.reason = that.pastMemory.reason;
                  that.formContent.city = that.pastMemory.city;
                  that.formContent.auditResult = that.pastMemory.auditResult;
                  that.formContent.usageCount = that.pastMemory.usageCount;
                  that.formContent.beginDate = that.pastMemory.beginDate;
                  that.formContent.endDate = that.pastMemory.endDate;

                  that.formContent.address = that.pastMemory.address;
                  that.formContent.operatorPhone = that.pastMemory.operatorPhone;
                  that.formContent.entourage = that.pastMemory.entourage;
                  that.formContent.entouragePhone = that.pastMemory.entouragePhone;

                  that.formContent.depUser = that.pastMemory.depUser;
                  that.formContent.depManageUser = that.pastMemory.depManageUser;
                  that.formContent.schoolUser = that.pastMemory.schoolUser;
                  that.formContent.schoolManageUser = that.pastMemory.schoolManageUser;

                  that.formContent.carNo = that.pastMemory.carNo;
                  that.formContent.startKM = that.pastMemory.startKM;
                  that.formContent.endKM = that.pastMemory.endKM;

                }
              }
            })
          }

        });
      },
      methods: {

      },
    }
</script>

<style scoped>

</style>
